/*
 * 
 * 
 */

package br.com.caelum.jdbc.tests;

import br.com.caelum.jdbc.*;
import java.sql.Connection;
import java.sql.SQLException;
import java.sql.PreparedStatement;

/**
 *
 * @author menandro.neto
 */
public class JDBCInsere {
    public static void main(String[] args) {
        Connection con;
        String sqlInsert = "insert into contatos(cntNome, cntEmail, cntEndereco) " +
                           "values (?, ?, ?)"; 
        try {
            // con = new MySQLTest().getConnection();
            con = new FBTest().getConnection();
            PreparedStatement pstm = con.prepareStatement(sqlInsert);
            
            pstm.setString(1, "Caelum");
            pstm.setString(2, "contato@caelum.com.br");
            pstm.setString(3, "R. das Patativas, 597, Torre B, Apto. 203, Imbuí");
            
            pstm.execute();
            pstm.close();
            con.close();
        }
        catch(SQLException e){
            e.printStackTrace();
        }
    }
}
